import java.util.*;

public class Main7 {
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();

        int arr[] = new int[n];
        for(int i =0;i<n;i++)
        {
            arr[i] = cin.nextInt();
        }

        int k = cin.nextInt();

        for(int j =0;j<k;j++)
        {
            int pos = cin.nextInt()-1;
            int tmp = arr[pos];
            for(int i = pos;i<n-1;i++)
            {
                arr[i] = arr[i+1];
            }
            arr[n-1] = tmp;
        }

        for(int i =0;i<n;i++)
        {
            if(i!=n-1)
                System.out.print(arr[i]+" ");
            else
                System.out.print(arr[i]);
        }

        cin.close();
    }
}
